<template>
  <div class="box">

    <div class="center">
      <h1> 欢迎登陆 </h1>

      <el-form ref="loginForm" :model="loginForm" label-width="120px" >
        <el-form-item label="admin">
          <el-input v-model="loginForm.username"></el-input>
        </el-form-item>

        <el-form-item label="password">
          <el-input v-model="loginForm.password" type="password"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="login">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>




<script>
export default {
  data() {
    return {
      loginForm: {
        username: '',
        password: '',
      },

    }
  },
  methods: {
    login() {
      if (this.loginForm.username === "admin" && this.loginForm.password === "123456") {
        this.$router.push("/home")
      }else {
        alert("用户名或者密码错误")
      }
    },
  },
};
</script>

<style scoped>
.box {
  width: 100%;
  height: 100vh;
  background-image: url("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F202004%2F23%2F20200423145806_Fywmx.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1638342124&t=79a6cbc4b2872c19ba39635084784442");
  background-repeat: no-repeat;
  background-size: cover;
  margin: 0;
  padding: 0;
}
h1 {
  font-size: 20px;
  text-align: center;
}

.el-form {
  width: 400px;
  height: 300px ;
}
.el-form-item {
  color: #080204;
}
.center {
  width: 400px;
  height: 300px;
  position: fixed;
  right: 100px;
  top: 200px;
  border: 1px solid #545c64;
}


</style>
